﻿using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IService
{
    public interface IGoodsTypeService
    {


        /// <summary>
        /// 模糊查询货品类型（带筛选条件）并查询所有
        /// </summary>
        /// <param name="typeNameOrCode">名称/编号（模糊）</param>
        /// <param name="status">状态（1=启用，0=停用，null=全部）</param>
        /// <param name="updateBy">操作人（模糊）</param>
        /// <param name="updateTime">操作时间（精确到天，null=全部）</param>
        Task<List<GoodsType>> GetFuzzyGoodsTypes(
            string typeNameOrCode,
            int? status,  // 改为可空类型，支持"不筛选"
            string updateBy,
            DateTime? startTime,  // 新增：开始时间
            DateTime? endTime    // 新增：结束时间
        );

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="ParentCategoryId"></param>
        /// <param name="GoodsTypeCode"></param>
        /// <param name="GoodsTypeName"></param>
        /// <param name="SortOrder"></param>
        /// <param name="Status"></param>
        /// <param name="Remarks"></param>
        /// <returns></returns>
        Task<List<GoodsType>> GoodsTypesAdd(
            string ParentCategoryId,
            string GoodsTypeCode,
            string GoodsTypeName,
            int SortOrder,
            int Status,
            string Remarks
            );
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="ParentCategoryId"></param>
        /// <param name="GoodsTypeCode"></param>
        /// <param name="GoodsTypeName"></param>
        /// <param name="SortOrder"></param>
        /// <param name="Status"></param>
        /// <param name="Remarks"></param>
        /// <returns></returns>
        Task<List<GoodsType>> GoodsTypesUpdate(
            int GoodsTypeId,  // 新增ID参数，用于定位要修改的记录
            string ParentCategoryId,
            string GoodsTypeCode,
            string GoodsTypeName,
            int SortOrder,
            int Status,
            string Remarks
            );
        
        /// <summary>
        /// 逻辑删除货品类型（更新is_delete=1）
        /// </summary>
        /// <param name="goodsTypeId">要删除的货品类型ID</param>
        /// <returns>返回受影响的行数（1=成功，0=未找到或已删除）</returns>
        Task<int> GoodsTypesDelete(int goodsTypeId);
        public Task<List<GoodsType>> GoodsTypesAllAsync();
        Task<ImportResult> ImportExcelAsync(Stream stream, string fileExt, string operatorName);
        Task<PagedResult<GoodsType>> GetPagedGoodsTypes(
            string typeNameOrCode,
            int? status,
            string updateBy,
            DateTime? startTime,
            DateTime? endTime,
            int pageNum,
            int pageSize
        );
        public class PagedResult<T>
        {
            public int Total { get; set; }
            public List<T> List { get; set; }
        }
    }
}
